/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author inftel
 */
@Entity
@Table(name = "tipoaviso")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipoaviso.findAll", query = "SELECT t FROM Tipoaviso t"),
    @NamedQuery(name = "Tipoaviso.findByIdTipoaviso", query = "SELECT t FROM Tipoaviso t WHERE t.idTipoaviso = :idTipoaviso"),
    @NamedQuery(name = "Tipoaviso.findByDescripcion", query = "SELECT t FROM Tipoaviso t WHERE t.descripcion = :descripcion")})
public class Tipoaviso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_TIPOAVISO")
    private Integer idTipoaviso;
    @Column(name = "DESCRIPCION")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoaviso")
    private Collection<Aviso> avisoCollection;

    public Tipoaviso() {
    }

    public Tipoaviso(Integer idTipoaviso) {
        this.idTipoaviso = idTipoaviso;
    }

    public Integer getIdTipoaviso() {
        return idTipoaviso;
    }

    public void setIdTipoaviso(Integer idTipoaviso) {
        this.idTipoaviso = idTipoaviso;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public Collection<Aviso> getAvisoCollection() {
        return avisoCollection;
    }

    public void setAvisoCollection(Collection<Aviso> avisoCollection) {
        this.avisoCollection = avisoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoaviso != null ? idTipoaviso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipoaviso)) {
            return false;
        }
        Tipoaviso other = (Tipoaviso) object;
        if ((this.idTipoaviso == null && other.idTipoaviso != null) || (this.idTipoaviso != null && !this.idTipoaviso.equals(other.idTipoaviso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Tipoaviso[ idTipoaviso=" + idTipoaviso + " ]";
    }
    
}
